package org.price.sql.repo.documents.config;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.apache.log4j.Logger;

public class SelectThread extends SQLThread {
    private static final Logger LOG = Logger.getLogger(SelectThread.class);

    public SelectThread(Connection connection) {
        super(connection);
    }

    @Override
    protected void executeQuery() throws Exception {
        PreparedStatement stm = getConnection().prepareStatement(
                "SELECT * FROM test LIMIT 1");
        ResultSet res = stm.executeQuery();

        while (res.next()) {
            LOG.info("---------------------------------------");
            LOG.info("Id: " + res.getString(1));
            LOG.info("Title : " + res.getString(2));
            LOG.info("---------------------------------------");
        }

        res.close();
        stm.close();
    }

}
